package cn.zero.letaomallspringboot.Constant;

import lombok.Getter;

@Getter
public enum ResultCode {
    // 成功场景
    SUCCESS(200, "操作成功"),
    // 参数错误
    PARAM_ERROR(4001, "参数格式错误"),
    PARAM_MISS(4002, "必填参数缺失"),
    UNAUTHORIZED(4003, "未授权，请登录"),
    // 权限错误
    NO_PERMISSION(4031, "无操作权限"),
    TOKEN_EXPIRED(4032, "登录令牌过期"),
    // 业务错误（订单相关）
    ORDER_NOT_FOUND(6001, "订单不存在"),
    ORDER_INSERT_FAIL(6002, "订单创建失败"),
    ORDER_UPDATE_FAIL(6003, "订单更新失败"),
    ORDER_DELETE_FAIL(6004, "订单删除失败"),
    ORDER_BATCH_DELETE_FAIL(6005, "订单批量删除失败"),
    // 用户相关错误
    USER_NOT_EXIST(7001, "用户不存在"),
    // 商品分类相关错误
    CATEGORY_NOT_FOUND(8001, "商品分类不存在"),
    CATEGORY_DELETE_FAIL(8002, "商品分类删除失败"),
    CATEGORY_INSERT_FAIL(8003, "商品分类新增失败"),
    CATEGORY_UPDATE_FAIL(8004, "商品分类更新失败"),
    CATEGORY_STATUS_UPDATE_FAIL(8005, "商品分类状态更新失败"),
    CATEGORY_HOT_UPDATE_FAIL(8006, "商品分类热门状态更新失败"),
    CATEGORY_RECOMMEND_UPDATE_FAIL(8007, "商品分类推荐状态更新失败"),
    // 商品相关错误
    GOOD_NOT_FOUND(9001, "商品不存在"),
    GOOD_INSERT_FAIL(9002, "商品新增失败"),
    GOOD_UPDATE_FAIL(9003, "商品更新失败"),
    GOOD_DELETE_FAIL(9004, "商品删除失败"),
    GOOD_BATCH_DELETE_FAIL(9005, "商品批量删除失败"),
    // 商品规格相关错误
    PRODUCT_SPEC_NOT_FOUND(10001, "商品规格不存在"),
    PRODUCT_SPEC_INSERT_FAIL(10002, "商品规格新增失败"),
    PRODUCT_SPEC_UPDATE_FAIL(10003, "商品规格更新失败"),
    PRODUCT_SPEC_DELETE_FAIL(10004, "商品规格删除失败"),
    // 系统错误
    SYSTEM_ERROR(5001, "系统异常，请联系管理员"),
    DB_ERROR(5002, "数据库操作异常"),
    THIRD_API_ERROR(5003, "第三方接口调用失败"),
    CUSTOM_ERROR(5004, "系统自定义异常，请联系管理员"),
    ADMIN_NOT_FOUND(5100, "管理员不存在"),
    ADMIN_USERNAME_EXISTS(5101, "用户名已存在"),
    ADMIN_EMAIL_EXISTS(5102, "邮箱已存在"),
    ADMIN_ADD_FAILED(5103, "新增管理员失败"),
    ADMIN_UPDATE_FAILED(5104, "更新管理员失败"),
    ADMIN_DELETE_FAILED(5105, "删除管理员失败，对应的管理员不存在"),
    PARAM_VALID_ERROR(5016,"密码不能为空");

    private final Integer code;
    private final String msg;

    ResultCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}